]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
tools/create-toolbox: Optionally create Builder config
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 17 Mar 2023 09:32:33 +0000 (10:32 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 16 May 2023 18:20:42 +0000 (18:20 +0000)
It is possible to run gnome-shell nested from gnome-builder,
but the setup is fairly tedious.

Add another option to the script to generate a suitable
.buildconfig file.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>

tools/toolbox/create-toolbox.sh

index 9f9eee0700cd0570c01908d7baa1e60c6dd53e65..4002901037d8f2e0d0142581507a367ab90c3fb3 100755 (executable)
@@ -18,6 +18,7 @@ usage() {
          -v, --version=VERSION   Create container for stable version VERSION
                                  (like 44) instead of the main branch
          -r, --replace           Replace an existing container
+         -b, --builder           Set up GNOME Builder configuration
          --skip-mutter           Do not build mutter
          -h, --help              Display this help
 
@@ -33,12 +34,33 @@ toolbox_run() {
   toolbox run --container $NAME "$@"
 }
 
+create_builder_config() {
+  local container_id=$(podman container inspect --format='{{.Id}}' $NAME)
+  local top_srcdir=$(realpath $(dirname $0)/../..)
+  local wayland_display=builder-wayland-0
+
+  cat >> $top_srcdir/.buildconfig <<-EOF
+
+       [toolbox-$NAME]
+       name=$NAME Toolbox
+       runtime=podman:$container_id
+       prefix=/usr
+       run-command=dbus-run-session gnome-shell --nested --wayland-display=$wayland_display
+
+       [toolbox-$NAME.runtime_environment]
+       WAYLAND_DISPLAY=$wayland_display
+       G_MESSAGES_DEBUG=GNOME Shell
+       XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
+       EOF
+}
+
 TEMP=$(getopt \
   --name $(basename $0) \
-  --options 'n:v:rh' \
+  --options 'n:v:rbh' \
   --longoptions 'name:' \
   --longoptions 'version:' \
   --longoptions 'replace' \
+  --longoptions 'builder' \
   --longoptions 'skip-mutter' \
   --longoptions 'help' \
   -- "$@")
@@ -65,6 +87,11 @@ while true; do
       shift
     ;;
 
+    -b|--builder)
+      SETUP_BUILDER=1
+      shift
+    ;;
+
     --skip-mutter)
       SKIP_MUTTER=1
       shift
@@ -94,3 +121,5 @@ podman pull $TOOLBOX_IMAGE:$TAG
 
 toolbox create --image $TOOLBOX_IMAGE:$TAG $NAME
 [[ $SKIP_MUTTER ]] || toolbox_run update-mutter
+
+[[ $SETUP_BUILDER ]] && create_builder_config